//
//  YKLineViewController.m
//  yuke
//
//  Created by Dejun Liu on 15/1/26.
//  Copyright (c) 2015年 juwan. All rights reserved.
//

#import "YKLineViewController.h"
#import "YKMLineCollectionViewCell.h"

@interface YKLineViewController ()<UICollectionViewDataSource,UICollectionViewDelegate>

@property (nonatomic,strong) UICollectionView *collectionView;
@property (nonatomic,strong) NSArray *listData;

@end

@implementation YKLineViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"经典路线";
    [self hideHomeNavigationBar];
    [self loadCollectionView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)loadCollectionView
{
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
    layout.itemSize = CGSizeMake(304, 153);
    layout.minimumInteritemSpacing = 15;
    layout.minimumLineSpacing = 15;
    layout.sectionInset = UIEdgeInsetsMake(20, 25, 15, 25);
    
    self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-49-64) collectionViewLayout:layout];
    self.collectionView.backgroundColor = [UIColor clearColor];
    [self.collectionView registerNib:[UINib nibWithNibName:@"YKMLineCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"cell"];
    self.collectionView.scrollEnabled = YES;
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    [self.view addSubview:_collectionView];
    
    self.listData = @[@"xxx",@"xxx",@"xxx",@"xxx",@"xxx",@"xxx",@"xxx",@"xxx",@"xxx",@"xxx",@"xxx",@"xxx"];
    
    [self.collectionView addHeaderWithCallback:^{
        
    }];
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.listData.count;
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    NSMutableDictionary *dic = [self.listData objectAtIndex:indexPath.row];
    
    YKMLineCollectionViewCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.mImageView.image = [UIImage imageNamed:@"demo2"];
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{

}

@end
